﻿using System;
using System.Data;
using System.Collections.Generic;

using System.Text;

namespace Model
{
    public class AccountModel:BaseModel
    {
        public const string TABLE_NAME = "Accounts";
        public const string ACCOUNT_ID_FIELD = "AccountId";
        public const string ACCOUNT_NAME_FIELD = "AccountName";
        public const string FIRST_NAME_FIELD = "FirstName";
        public const string LAST_NAME_FIELD = "LastName";
        public const string CODE_FIELD = "AccountName";
        public const string DATE_CREATE_FIELD = "DateCreate";
        public const string COMPANY_NAME_FIELD = "CompanyName";

        public AccountModel()
            : base(TABLE_NAME, ACCOUNT_ID_FIELD)
        {

        }

        public void AddAccountAdminAndUserDefaulf(int AccountId, string AccountName, string FirstName, string LastName, string CompanyName, string Email, string Phone, string Address, string Street1, string Street2, string City, string StateCode, string CountryCode, string ZipCode)
        {
            ExecuteNonDataQuery("AddAccountAdminAndUserDefaulf", AccountId, AccountName, FirstName, LastName, CompanyName, Email, Phone, Address, Street1, Street2, City, StateCode, CountryCode, ZipCode);
        }

        public void InsertUpdateAccount(int AccountId, string AccountName, string FirstName, string LastName)
        {
            ExecuteNonDataQuery("InsertUpdateAccount", AccountId, AccountName, FirstName, LastName);
        }

        public void InsertUpdateAccountAddressAll(int AccountId, string AccountName, string FirstName, string LastName, string CompanyName, string Email, string Phone, string Address, string Street1, string Street2, string City, string StateCode, string CountryCode, string ZipCode)
        {
            ExecuteNonDataQuery("InsertUpdateAccountAddressAll", AccountId, AccountName, FirstName, LastName, CompanyName, Email, Phone, Address, Street1, Street2, City, StateCode, CountryCode, ZipCode);
        }

        public void InsertUpdateAccountAddressById(int AccountId, string CompanyName, string Email, string Phone, string Address, string Street1, string Street2, string City, string StateCode, string CountryCode, string ZipCode)
        {
            ExecuteNonDataQuery("InsertUpdateAccountAddressById", AccountId, CompanyName, Email, Phone, Address, Street1, Street2, City, StateCode, CountryCode, ZipCode);
        }

        public DataTable GetAddressInfoByAccountName(string AccountName)
        {
            return GetDataTable("GetAddressInfoByAccountName", AccountName);
        }

        public DataTable GetAddressInfoByAccountId(int AccountId)
        {
            return GetDataTable("GetAddressInfoByAccountId", AccountId);
        }

        public DataTable GetListAccounts()
        {
            return GetDataTable("GetListAccounts");
        }

        public DataTable GetListUserByAccountName(string AccountName)
        {
            return GetDataTable("GetListUserByAccountName", AccountName);
        }

        public DataTable GetListUserByAccountId(int AccountId)
        {
            return GetDataTable("GetListUserByAccountId", AccountId);
        }

        public DataTable DeleteAccount(int AccountId)
        {
            return GetDataTable("DeleteAccount", AccountId);
        }

        public DataTable GetAccountAddressInfoByUserId(int UserId)
        {
            return GetDataTable("GetAccountAddressInfoByUserId", UserId);
        }

        public DataTable GetListContactByAccountId(int AccountId)
        {
            return GetDataTable("GetListContactByAccountId", AccountId);
        }

        public DataRow DeleteContactOfAccount(int ContactId)
        {
            return GetDataRow("DeleteContactOfAccount", ContactId);
        }
    }
}
